package top.mengchaob.fileserver.netty.jpa;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import top.mengchaob.fileserver.netty.table.FileLBDo;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @title：
 * @author: mengchaob
 * @date: 2021年05月12日 14:42
 * @description:
 */
public interface FileLBRepository extends JpaRepository<FileLBDo, String> {
    @Query("select f FROM FileLBDo f WHERE f.lbCode like CONCAT(?1,'%')")
    public List<FileLBDo> queryByLbcode(@Param("lb_code")String lb_code);
    @Modifying
    @Query("DELETE FROM FileLBDo f WHERE f.lbCode like CONCAT(?1,'%')")
    public int delByLbcode(@Param("lb_code")String lb_code);
    @Query("select t from FileLBDo t order by t.lbCode")
    public List<FileLBDo> queryAll();
}
